package config

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	Nacos struct {
		IpAddr string
		DataId string
		Group  string
	}
	ALiYun struct {
		AccessKeyId     string
		AccessKeySecret string
	}
}

var ViperData *AppConfig

func GetViperData() {
	viper.SetConfigFile("./config/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		fmt.Println("读取失败")
		return
	}
	fmt.Println("读取成功")
	err = viper.Unmarshal(&ViperData)
	if err != nil {
		fmt.Println("解析失败")
		return
	}
	fmt.Println("解析成功")
}
